package com.hxc.web.controller.interest;

import java.util.List;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hxc.common.annotation.Log;
import com.hxc.common.core.controller.BaseController;
import com.hxc.common.core.domain.AjaxResult;
import com.hxc.common.enums.BusinessType;
import com.hxc.interest.domain.TReactionThumbsup;
import com.hxc.interest.service.ITReactionThumbsupService;
import com.hxc.common.core.page.TableDataInfo;

/**
 * 点赞记录Controller
 * 
 * @author hxc
 * @date 2021-08-19
 */
@Api(tags = "点赞记录管理")
@RestController
@RequestMapping("/interest/thumbsup")
public class TReactionThumbsupController extends BaseController
{
    @Autowired
    private ITReactionThumbsupService tReactionThumbsupService;

    /**
     * 查询点赞记录列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TReactionThumbsup tReactionThumbsup)
    {
        startPage();
        List<TReactionThumbsup> list = tReactionThumbsupService.selectTReactionThumbsupList(tReactionThumbsup);
        return getDataTable(list);
    }

    /**
     * 新增点赞记录
     */
    @ApiOperation(value = "新增点赞记录", notes = "查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "reactionId", value = "事件id", required = true, dataType = "Long"),
            @ApiImplicitParam(name = "userId", value = "点赞用户id", dataType = "Long")
    })
    @Log(title = "点赞记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TReactionThumbsup tReactionThumbsup)
    {
        return toAjax(tReactionThumbsupService.insertTReactionThumbsup(tReactionThumbsup));
    }

    /**
     * 删除点赞记录
     */
    @ApiOperation(value = "删除点赞记录", notes = "删除")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "reactionId", value = "事件id", required = true, dataType = "Long"),
            @ApiImplicitParam(name = "userId", value = "点赞用户id", dataType = "Long")
    })
    @Log(title = "删除点赞记录", businessType = BusinessType.DELETE)
	@GetMapping("remove")
    public AjaxResult remove(TReactionThumbsup tReactionThumbsup)
    {
        return toAjax(tReactionThumbsupService.deleteTReactionThumbsup(tReactionThumbsup));
    }
}
